//
//  CHSViewController.m
//  ChangeEnvironmentManager
//
//  Created by 海参 on 07/21/2021.
//  Copyright (c) 2021 海参. All rights reserved.
//

#import "CHSViewController.h"
#import <Masonry/Masonry.h>
#import <ChangeEnvironmentManager/ChangeEnvironmentManagerKit.h>

@interface CHSViewController ()

@property (nonatomic, strong) UIButton *changeEnvironmentBtn;

@end

@implementation CHSViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
	// Do any additional setup after loading the view, typically from a nib.

[self.view addSubview:self.changeEnvironmentBtn];
[self.changeEnvironmentBtn mas_makeConstraints:^(MASConstraintMaker *make) {

    make.left.mas_equalTo(self.view.mas_left).with.offset(12);
    make.right.mas_equalTo(self.view.mas_right).with.offset(-12);
    make.centerY.mas_equalTo(self.view.mas_centerY).with.offset(20);
}];

    
    
}


-(UIButton *)changeEnvironmentBtn{
    if (!_changeEnvironmentBtn) {
        _changeEnvironmentBtn = [UIButton new];
        [_changeEnvironmentBtn addTarget:self action:@selector(changeEnvironmentBtnAction:) forControlEvents:UIControlEventTouchUpInside];
        [_changeEnvironmentBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];

        if ([ChangeEnvironmentManager sharedInstance].buildConfiguration == BuildConfigurationDebug) {
            [_changeEnvironmentBtn setTitle:@"Debug模式，切换环境" forState:UIControlStateNormal];
            NSLog(@"Debug模式");
        }else if ([ChangeEnvironmentManager sharedInstance].buildConfiguration == BuildConfigurationProfile){
            [_changeEnvironmentBtn setTitle:@"Profile模式，切换环境" forState:UIControlStateNormal];
            NSLog(@"Profile模式");
        }
        else if ([ChangeEnvironmentManager sharedInstance].buildConfiguration == BuildConfigurationRelease){
            [_changeEnvironmentBtn setTitle:@"Release模式，切换环境" forState:UIControlStateNormal];
            NSLog(@"Release模式");
        }
        
#ifdef DEBUG
      
//#elif PROFILE

#else
 
#endif
    }
    return _changeEnvironmentBtn;
}

//点击切换开发环境
- (void)changeEnvironmentBtnAction:(id)sender {
    
    UIViewController *vc = [ChangeEnvironmentController new];
    [self.navigationController pushViewController:vc animated:YES];
}



- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
